package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsRegionMapper;
import com.qf.mapper.DtsRoleMapper;
import com.qf.pojo.DtsRegion;
import com.qf.service.DtsRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

@Service
public class DtsRegionServiceImpl implements DtsRegionService {
    @Autowired
    DtsRegionMapper regionMapper;
    @Override
    public IPage<DtsRegion> findByPage(Integer page, Integer limit, String name, String code) {
        IPage<DtsRegion> iPage = new Page<>(page,limit);

        QueryWrapper<DtsRegion> qw = new QueryWrapper<>();
        if(!StringUtils.isEmpty(name)){
            qw.like("name",name);
        }
        if(!StringUtils.isEmpty(code)){
            qw.like("code",code);
        }
        regionMapper.selectPage(iPage,qw);

        return iPage;
    }
}
